package com.carleasoft.mps.adu.business.dept.controller;


import com.carleasoft.mps.adu.business.dept.bean.po.AuthorityDeptTypePagePo;
import com.carleasoft.mps.adu.business.dept.bean.po.AuthorityDeptTypePo;
import com.carleasoft.mps.adu.business.dept.service.IAuthorityDeptTypeService;
import com.carleasoft.mps.core.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 部门分类表 前端控制器
 * </p>
 *
 * @author ztm
 * @since 2021-12-14
 */
@RestController
@RequestMapping("/deptType")
public class AuthorityDeptTypeController {
    @Autowired
    IAuthorityDeptTypeService authorityDeptTypeService;

    /**
     * 添加用户类型
     * ok
     * @param authorityDeptTypePo
     * @return ResultBody
     */
    @PostMapping("/add")
    public R addUserType(@RequestBody AuthorityDeptTypePo authorityDeptTypePo){
        //获取当前登陆人信息
        authorityDeptTypeService.addDeptType(authorityDeptTypePo);
        return R.ok();
    }
    /**
     * 编辑用户类型
     * ok
     * @param authorityDeptTypePo
     * @return ResultBody
     */
    @PostMapping("/update")
    public R updateDeptType(@RequestBody AuthorityDeptTypePo authorityDeptTypePo){
        //获取当前登陆人信息
        authorityDeptTypeService.updateDeptType(authorityDeptTypePo);
        return R.ok();
    }

    /**
     * 删除用户类型
     * ok
     * @param deptTypeCode
     * @return ResultBody
     */
    @PostMapping("/delete")
    public R deleteDeptType(@RequestBody String deptTypeCode){
        authorityDeptTypeService.deleteDeptType(deptTypeCode);
        return R.ok();
    }

    @PostMapping("/list")
    public R pageQuery(@RequestBody AuthorityDeptTypePagePo authorityDeptTypePagePo){
        return R.ok(authorityDeptTypeService.deptTypePage(authorityDeptTypePagePo));
    }
}
